home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / GETS.C < prev    next >
Text File  |  1986-05-18  |  896b  |  31 lines

  1. /* 1.0  12-17-84 */
  2. /************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1984        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10. #include "stdio.h"
  11.  
  12. /************************************************************************/
  13.     STRING
  14. gets(line)        /* get line up to newline or EOF from stdin.
  15.                Return line if ok, NULL if empty and EOF.    */
  16. /*----------------------------------------------------------------------*/
  17. STRING line;
  18. {
  19.     FAST STRING s;
  20.     FAST int i;
  21.  
  22.     s = line;
  23.     while (((i = getchar()) ISNT EOF) AND (i ISNT '\n'))
  24.         *s++ = i;
  25.     *s = NULL;
  26.     if ((i IS EOF) AND (s IS line))
  27.         return NULL;
  28.  
  29.     return line;
  30. }
  31.